/**
  ETFRoot project, Anyang Normal University && IMP-CAS
  \class ETFPlaHit
  \brief for a hit in a plastic scintillator coupled at 1 or 2 ends with PMT(s)
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2021-10-29
  \date 2021-11-30 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2021-10-29   <td>Asia Sun    <td>file created                  </tr>
  </table>

  \copyright Copyright (c) 2021 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFPlaHit_h
#define ETFPlaHit_h

#include "ETFHit.h"

class ETFHPTDCChannel;

class ETFPlaHit : public ETFHit{
public:
  ETFPlaHit();
  ETFPlaHit(const ETFPlaHit &t); ///< copy ctor
  ETFPlaHit &operator=(const ETFPlaHit &t); ///< assignment ctor
  virtual ~ETFPlaHit();

  virtual void Initialize();
  void SetStripId(int id){ fStripId = id; }
  /// \param udvh: 0-1-2-3: uv-uh-dv-dh
  void SetDataChannel(const ETFHPTDCChannel *ch, int udvh);
  void SetLength(double l){ fLength = l; }
  virtual void SetDelay(double delay){ fDelay = delay; }

  const ETFHPTDCChannel *GetDataChannel(int udvh) const;
  double GetTime();
  double GetTimeU() const; ///< time of the upper end
  double GetTimeD() const; ///< time of the down end
  double GetHitPosition(); ///< distance to the down end
  int GetStripId() const{ return fStripId; }
  /// \reval: 1: singly fired; 3: bothly fired, if hitPos good, then 4
  virtual int GetFiredStatus();
  virtual void Print(); ///< print the hit info
  virtual void ConfigureDraw(); ///< configure fGHit

  friend class ETFTOFWall;

  ClassDef(ETFPlaHit, 1); // ABC for an ETF hit

protected:
  static const double VEFF; ///< effective light velocity in pla: in mm/ns
  int fLength; /// the distance between the two PMTs
  int fStripId; ///< strip id
  double fHitPos, fHitTime;
  const ETFHPTDCChannel *fUCh[2], *fDCh[2]; //-> ///< the original data channel, Up and Down, [V-H]
};

#endif
